package com.itheima.ArrayList;

import com.itheima.domain.Student;

import java.util.ArrayList;
import java.util.Scanner;

public class Array3 {
    public static void main(String[] args) {
        //2. 创建一个存储学生对象的集合,存储3个学生对象,使用程序实现
        ArrayList<Student> list = new ArrayList<>();

        Student st1 = new Student("张三", 23);
        Student st2 = new Student("李四", 25);
        Student st3 = new Student("王二", 27);
        list.add(st1);
        list.add(st2);
        list.add(st3);
        for (int i = 0; i < list.size(); i++) {
            Student st = list.get(i);
            System.out.println(st.getName() + "---" + st.getAge());

        }
    }
}